/*-------------------------------------------------------------------------


***************** Modification History ***********************************
   @doc
   @module Everest.h - Header file for Everest functionality |
   @end
   
$Log: /SoftPay/SPK2SIM/Source/Include/everest.h $ 
**************************************************************************

   Copyright (C) 1999 by VeriFone, Inc.

   All rights reserved.  No part of this software may be reproduced,
   transmitted, transcribed, stored in a retrieval system, or translated
   into any language or computer language, in any form or by any means,
   electronic, mechanical, magnetic, optical, chemical, manual or otherwise,
   without the prior written permission of VeriFone, Inc.
--------------------------------------------------------------------------*/

#define EVEREST_DEFINED
#ifdef  EVEREST_DEFINED

#include <transact.h>


#define INDEX_TO_MSG_SIZE           2
#define INDEX_TO_TABLE_MSG_SIZE     1
#define TABLE_TO_MSG_SIZE           1

#define PINPAD_MESSAGE_FILE "pin"

/* Structure passed as input for Everest PIN Encryption */
typedef struct tagEverestInfoStruct
{
    char pchPrimaryAcctInfo[19+1];
    char pchDispStr1[16+1];
    char pchDispStr2[16+1];
    char pchEncryptionKey[16+1];
    char pchMaxPIN[2+1];
    char pchMinPIN[2+1];
    int  inKeySlotPos;
    char pchDispOver[16+1];
    char pchEncryptedPIN[16+1];
} EVERESRINFOSTRUCT;

typedef struct tagEverestObject
{
    int inHandle;
   	int inType;
    int inTimeout;      
    	
/* Function pointers for object */
    	int (*inInitEverest)(void);
    	int (*inSwipeCardIdlePrompt)(void);
    	int (*inDisplayPinPadString)(char chClrDisplay, char *chDispString);
    	int (*inPINEntryRequest)(TRANSACTION_OBJECT *pobTran);
    	
    
} EVEREST_OBJECT;

extern EVEREST_OBJECT obEverest;

extern int hClock;

#ifdef MAC

typedef struct
{
    int  inEverestPINPadType;
    int  inKeySlot;
    int  inMacDataType;
    char pchMacKey[16+1];
    char pchMacSecKey[16+1];
    int  inMacType;
    char pchTerminalMac[8+1];
    char pchHostMac[8+1];
} MACINFOSTRUCT;

#endif /* MAC */


int  inColdInitEverest(TRANSACTION_OBJECT *pobTran);
int  inEverestPinPadTypeVal(char *pchValue);
int  inSetEverestKeyManagement(void);
int  inEverestConnectTest(void);
int  inInitEverest(void);
int  inInitializeEverest(void);
int  inSetupEverest(int inEverestPinPadType);
int  inSetupEverestInfo(int inPinEverestPadType);
int  inExecEverestIdlePrompt(void);
int  inGetEverestAccMac(TRANSACTION_OBJECT *pobTran);
int  inSendEverestData(char *pchMsg, int inTimeout, VS_BOOL fWaitForAck);
int  inSwipeCardIdlePrompt(void);
int  inResetEverest(void);
int  inParseCardData(TRANSACTION_OBJECT *pobTran);
void vdSendEverestMessage(long InMessageIndex);
int  inRecvEverestData(char *pchRecvBuf, int inTimeout, int inMaxRecSize, VS_BOOL fSendAck);
void vdDispEverestPkt73Error(char chError);
int  inParseSelectPaymentKey(TRANSACTION_OBJECT *pobTran);
int  inPINEntryRequest(TRANSACTION_OBJECT *pobTran);


int inHHGetPinAccMac(TRANSACTION_OBJECT *pobTran);

#endif  /* EVEREST_DEFINED */
